﻿using System;
using TickSharp.Core.Model;

namespace TickSharp.Core.Enum
{
    public class StrongEntryFilter<T> : EntryFilter
    {
        private readonly Func<T, string> _stringFunc;

        public StrongEntryFilter(string apiName) : this(apiName, x => x.ToString())
        {
        }

        public StrongEntryFilter(string apiName, Func<T, string> stringFunc) : base(apiName)
        {
            _stringFunc = stringFunc;
        }

        public EntryFilterValue Create(T projectId)
        {
            return new EntryFilterValue(this, _stringFunc(projectId));
        }
    }
}